/* 安全事件分析平台样式文件 */

/* CSS 变量定义 */
:root {
    /* 色彩系统 */
    --color-primary-light: #f0f7ff;
    --color-primary-mid: #e1f0ff;
    --color-primary-dark: #d1e8ff;
    --color-primary-hover: #c2e0ff;
    --color-primary-border: rgba(96, 165, 250, 0.4);
    --color-primary-accent: rgba(59, 130, 246, 0.15);
    
    --color-bg: #f8fafc;
    --color-bg-light: #f1f5f9;
    --color-bg-mid: #e2e8f0;
    --color-bg-dark: #cbd5e1;
    
    --color-text-primary: #334155;
    --color-text-secondary: #64748b;
    --color-text-tertiary: #94a3b8;
    
    --color-critical: #ef4444;
    --color-high: #f97316;
    --color-medium: #f59e0b;
    --color-low: #3b82f6;
    --color-info: #06b6d4;
    
    --color-status-pending: #f59e0b;
    --color-status-analyzing: #3b82f6;
    --color-status-resolved: #10b981;
    --color-status-false: #64748b;
    
    /* 阴影 */
    --shadow-default: 0 4px 12px rgba(0, 0, 0, 0.02);
    --shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.04);
    
    /* 圆角 */
    --radius-small: 8px;
    --radius-medium: 12px;
    --radius-large: 50%;
    
    /* 间距 */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
}

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* 背景网格图案 */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    z-index: -1;
    pointer-events: none;
}

/* 主容器布局 */
.main-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* 左侧事件列表 */
.event-list-container {
    width: 320px;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--color-primary-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease;
}

.event-list-header {
    padding: 1rem;
    border-bottom: 1px solid var(--color-primary-border);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.event-list-header h2 {
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    font-weight: 600;
    color: var(--color-text-primary);
}

/* 搜索框样式 */
.search-container {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--color-primary-border);
    border-radius: var(--radius-small);
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-low);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.search-container::before {
    content: '🔍';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-tertiary);
    font-size: 0.875rem;
}

.filter-buttons {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

/* 事件列表 */
.event-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.event-item {
    padding: 12px;
    border-radius: var(--radius-medium);
    transition: all 0.3s ease;
    position: relative;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.event-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-low);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.event-item:hover {
    background-color: var(--color-primary-light);
    padding-left: 16px;
    padding-right: 8px;
}

.event-item:hover::after {
    transform: translateX(0);
}

.event-item.selected::after {
    transform: translateX(0);
}

.event-item:hover {
    background-color: var(--color-primary-light);
    transform: translateY(-1px);
}

.event-item.selected {
    background-color: var(--color-primary-accent);
    border-left: 3px solid var(--color-low);
}

/* 中间主内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-right: 0;
    transition: margin-right 0.3s ease;
}

/* 顶部操作栏 */
.global-actions {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--color-primary-border);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-default);
}

.time-range-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.action-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

/* 标签页导航 */
.tab-navigation {
    display: flex;
    background-color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--color-primary-border);
    padding-left: 1rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.tab-navigation button {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    white-space: nowrap;
}

.tab-navigation button:hover {
    color: var(--color-low);
}

.tab-navigation button.active {
    color: var(--color-low);
    border-bottom: 2px solid var(--color-low);
}

/* 标签页内容 */
.tab-content {
    flex: 1;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tab-content.active {
    opacity: 1;
}

/* 右侧关联信息面板 */
.related-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--color-primary-border);
    transition: all 0.3s ease;
    z-index: 100;
    width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.related-panel.collapsed {
    width: 0;
    padding: 0;
    border-left: none;
}

.related-panel.w-80 {
    width: 320px;
}

.related-panel-header {
    padding: 1rem;
    border-bottom: 1px solid var(--color-primary-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.related-panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.related-content {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}

/* 关联信息卡片样式 */
.related-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-medium);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-default);
    border: 1px solid var(--color-primary-border);
}

.related-card .card-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-text-primary);
}

/* 相似事件列表样式 */
.similar-events-list, .related-assets-list, .ioc-list, .attack-patterns-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.similar-event-item, .related-asset-item, .ioc-item, .attack-pattern-item {
    padding: 0.75rem;
    border-radius: var(--radius-small);
    background-color: rgba(248, 250, 252, 0.8);
    border: 1px solid var(--color-primary-border);
    transition: all 0.2s ease;
}

.similar-event-item:hover, .related-asset-item:hover, .ioc-item:hover, .attack-pattern-item:hover {
    background-color: rgba(236, 242, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* 相似事件项样式 */
.similar-event-title {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--color-text-primary);
    margin-bottom: 0.25rem;
}

.similar-event-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
}

.similarity-score {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

/* 关联资产项样式 */
.asset-name {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--color-text-primary);
    margin-bottom: 0.25rem;
}

.asset-info {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.asset-threat-level {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--color-critical);
    display: inline-block;
}

/* IOC项样式 */
.ioc-value {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--color-text-primary);
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.ioc-info {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.ioc-confidence {
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.confidence-high {
    background-color: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.confidence-medium {
    background-color: rgba(234, 179, 8, 0.1);
    color: #d97706;
}

.confidence-low {
    background-color: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* 攻击模式项样式 */
.pattern-name {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--color-text-primary);
    margin-bottom: 0.25rem;
}

.pattern-description {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.pattern-framework {
    font-size: 0.7rem;
    color: var(--color-text-tertiary);
    font-style: italic;
}

/* 关联事件项样式 */
.related-event-item {
    padding: 0.75rem;
    border-radius: var(--radius-small);
    background-color: rgba(248, 250, 252, 0.8);
    border: 1px solid var(--color-primary-border);
    transition: all 0.2s ease;
    cursor: pointer;
}

.related-event-item:hover {
    background-color: rgba(236, 242, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* 卡片样式 */
.info-card {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-medium);
    border: 1px solid var(--color-primary-border);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-default);
    transition: all 0.3s ease;
}

.info-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.info-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* 标签样式 */
.tag {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tag-critical {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--color-critical);
}

.tag-high {
    background-color: rgba(249, 115, 22, 0.1);
    color: var(--color-high);
}

.tag-medium {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--color-medium);
}

.tag-low {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--color-low);
}

.tag-info {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--color-info);
}

/* 状态标签样式 */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-pending {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--color-status-pending);
}

.status-analyzing {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--color-status-analyzing);
}

.status-resolved {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-status-resolved);
}

.status-false {
    background-color: rgba(100, 116, 139, 0.1);
    color: var(--color-status-false);
}

/* 按钮样式 */
.btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-small);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: all 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--color-low);
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: white;
    color: var(--color-text-primary);
    border: 1px solid var(--color-primary-border);
}

.btn-secondary:hover {
    background-color: var(--color-primary-light);
    transform: translateY(-1px);
}

.btn-group {
    display: flex;
    gap: var(--spacing-xs);
}

/* 攻击链样式 */
.attack-chain {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4px;
    background-color: var(--color-bg-mid);
    border-radius: 2px;
    margin-bottom: 8px;
}

.chain-stage {
    flex: 1;
    height: 100%;
    background-color: var(--color-bg-mid);
    border-radius: 2px;
    margin-right: 2px;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.chain-stage:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chain-stage.completed {
    background-color: var(--color-status-resolved);
    animation: pulse 2s infinite;
}

.chain-stage:last-child {
    margin-right: 0;
}

.chain-stage.completed {
    background-color: var(--color-low);
}

.chain-stage.current {
    background-color: var(--color-critical);
    position: relative;
}

.chain-stage.current::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-color: var(--color-critical);
    border-radius: 50%;
}

.chain-stage.orange {
    background-color: #FF8C00;
}
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--color-critical);
}

/* 时间线样式 */
.timeline {
    position: relative;
    padding-left: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--color-primary-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 6px;
    width: 8px;
    height: 8px;
    background-color: var(--color-low);
    border-radius: 50%;
    border: 2px solid white;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

/* 日志容器样式 */
.logs-container {
    max-height: 400px;
    overflow-y: auto;
}

.log-entry {
    padding: 12px;
    border-bottom: 1px solid var(--color-primary-border);
    transition: background-color 0.3s ease;
}

.log-entry:hover {
    background-color: var(--color-primary-light);
}

.log-entry:last-child {
    border-bottom: none;
}

/* 代码块样式 */
.code-block {
    background-color: var(--color-bg-light);
    padding: 12px;
    border-radius: var(--radius-small);
    font-family: 'Courier New', monospace;
    overflow-x: auto;
    border: 1px solid var(--color-primary-border);
}

/* 表格样式 */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    background-color: var(--color-bg-light);
    padding: 8px 12px;
    text-align: left;
    font-weight: 500;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-primary-border);
}

.table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-primary-border);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover {
    background-color: var(--color-primary-light);
}

/* 通知样式 */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius-medium);
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-hover);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    background-color: var(--color-low);
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

/* 渐入动画 */
.fade-in {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 高级筛选面板 */
.filter-panel {
    background-color: rgba(255, 255, 255, 0.9);
    border-top: 1px solid var(--color-primary-border);
    padding: 1rem;
    transition: all 0.3s ease;
}

.filter-panel.hidden {
    display: none;
}

/* 地理位置标记 */
.geo-marker {
    position: relative;
    padding-left: 16px;
}

.geo-marker::before {
    content: '📍';
    position: absolute;
    left: 0;
    top: 0;
    font-size: 0.875rem;
}

/* 响应式设计 */
@media (max-width: 1280px) {
    .event-list-container {
        width: 300px;
    }
    
    .related-panel.w-80 {
        width: 320px;
    }
    
    .main-content {
        margin-right: -320px;
    }
}

@media (max-width: 1024px) {
    .event-list-container {
        width: 260px;
    }
    
    .related-panel.w-80 {
        width: 260px;
    }
    
    .main-content {
        margin-right: -260px;
    }
    
    /* 优化标签页布局 */
    .tab-navigation button {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .event-list-container {
        width: 100%;
        height: 250px;
        border-right: none;
        border-bottom: 1px solid var(--color-primary-border);
    }
    
    .main-content {
        margin-right: 0;
        min-height: calc(100vh - 250px);
    }
    
    .related-panel.w-80 {
        width: 100%;
        height: 300px;
    }
    
    .tab-navigation {
        padding-left: 0.5rem;
        overflow-x: auto;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }
    
    .tab-navigation::-webkit-scrollbar {
        display: none; /* Chrome/Safari/Opera */
    }
    
    .tab-navigation button {
        padding: 0.75rem 1rem;
        white-space: nowrap;
    }
    
    .global-actions {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .time-range-selector {
        justify-content: center;
    }
    
    .action-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    /* 增强卡片在移动设备上的显示 */
    .card {
        margin-bottom: 1rem;
        padding: 1rem;
    }
    
    /* 优化信息卡片布局 */
    .info-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    /* 触摸目标尺寸优化 */
    button, .btn, .tag, .event-item, .ioc-item {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 优化攻击链可视化 */
    .attack-chain {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .attack-chain-node {
        width: 100%;
    }
}

@media (max-width: 480px) {
    /* 移动小屏优化 */
    body {
        font-size: 14px;
    }
    
    .header {
        padding: 0.75rem;
    }
    
    .header h1 {
        font-size: 1.25rem;
    }
    
    .event-list-container {
        height: 200px;
    }
    
    .card {
        padding: 0.75rem;
    }
    
    .card h3 {
        font-size: 1rem;
    }
    
    /* 优化底部操作区 */
    .global-actions {
        position: static;
        margin-top: 1rem;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-light);
}

::-webkit-scrollbar-thumb {
    background: var(--color-bg-dark);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-tertiary);
}

/* 加载状态 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-bg-dark);
    border-radius: 50%;
    border-top-color: var(--color-low);
    animation: spin 0.8s linear infinite;
}

/* 数据更新动画 */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 数值变化动画 */
.number-change {
    transition: all 0.5s ease;
    display: inline-block;
}

.number-change.positive {
    color: var(--color-status-resolved);
    animation: scaleUp 0.5s ease;
}

.number-change.negative {
    color: var(--color-critical);
    animation: scaleDown 0.5s ease;
}

@keyframes scaleUp {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes scaleDown {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.9); }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 脉冲动画 */
.pulse {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 浮动动画 */
.floating {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-4px);
    }
    100% {
        transform: translateY(0px);
    }
}

/* 数据可视化容器 */
.chart-container {
    height: 200px;
    position: relative;
    overflow: hidden;
}